IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SrvrInstncSchedJobHistoryMSSQL]') AND type in (N'U'))
BEGIN
     DROP TABLE [dbo].[SrvrInstncSchedJobHistoryMSSQL]
END
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[SrvrInstncSchedJobHistoryMSSQL](
     [SrvrInstncId]              [int]           NOT NULL,
     [JobHistoryId]              [int]           NOT NULL,
     [PackageExecutionId]        [bigint]        NOT NULL,
     [SrvrInstncSchedJobId]      [int]           NOT NULL,
     [JobStepId]                 [int]           NOT NULL,
     [JobStepName]               [varchar](128)  NOT NULL,
     [JobStepMessage]            [varchar](4000)     NULL,
     [JobRunStatus]              [varchar](15)   NOT NULL,
     [JobRunDt]                  [datetime]      NOT NULL,
     [JobRunDurationInSec]       [int]           NOT NULL,
     [OperatorEmailed]           [varchar](128)  NOT NULL,
     [OperatorPaged]             [varchar](128)  NOT NULL,
     [OperatorNetSent]           [varchar](128)  NOT NULL,
     [RetriesAttempted]          [int]           NOT NULL,
     [JobStartMethod]            [varchar](15)   NOT NULL,
     [JobExecutedOnSrvrInstncId] [int]               NULL,
     [JobExecutedOnServer]       [varchar](128)      NULL,
     CONSTRAINT [PK_SrvrInstncSchedJobHistoryMSSQL] PRIMARY KEY CLUSTERED ( [SrvrInstncId] ASC, [JobHistoryId] ASC )
) ON [PRIMARY]
GO

SET ANSI_PADDING OFF
GO

CREATE UNIQUE NONCLUSTERED INDEX [IX_SrvrInstncSchedJobHistoryMSSQL_SecondaryKey] ON [dbo].[SrvrInstncSchedJobHistoryMSSQL] 
     ( [SrvrInstncId] ASC, [SrvrInstncSchedJobId] ASC, [JobHistoryId] ASC ) ON [Data_Index]
GO
